﻿@{
    ViewBag.Title = "ItemForm";
    Layout = "~/Views/Shared/_Form.cshtml";
}

<script>
    var keyValue = request('keyValue');

    $(function () {
        initControl();
    })
    //初始化控件
    function initControl() {
        //获取表单
        if (!!keyValue) {
            $.SetForm({
                url: "../../PropertyManage/SecurityPatrol/GetItemEntity",
                param: { keyValue: keyValue },
                success: function (data) {
                    $("#form1").SetWebControls(data);
                }
            });
        }
    }

    //保存表单
    function AcceptClick() {
        if (!$('#form1').Validform()) {
            return false;
        }
        var postData = $("#form1").GetWebControls(keyValue);
        var Unit = $('#Unit').val();
        
        $.SaveForm({
            url: "../../PropertyManage/SecurityPatrol/SaveItemForm?keyValue=" + keyValue,
            param: postData,
            loading: "正在保存数据...",
            success: function () {
                top.frames["Form"].$("#gridTable").trigger("reloadGrid");
            }
        })
    }
</script>

<div style="margin-top: 20px; margin-right: 30px;">
    <table class="form">
        <tr>
            <td class="formTitle">项目名称<font face="宋体">*</font></td>
            <td class="formValue">
                <input id="Name" type="text" onblur="$.ExistField(this.id, '../../PropertyManage/SecurityPatrol/ExistItemName')" class="form-control" placeholder="请输入名称" isvalid="yes" checkexpession="NotNull" />
            </td>
        </tr>
        <tr>
            <td class="formTitle">项目编号<font face="宋体">*</font></td>
            <td class="formValue">
                <input id="Code" type="text" onblur="$.ExistField(this.id, '../../PropertyManage/SecurityPatrol/ExistEnCode')" class="form-control" placeholder="请输入编号" isvalid="yes" checkexpession="NotNull" />
            </td>
        </tr>
        <tr>
            <th class="formTitle">频次<font face="宋体">*</font></th>
            <td class="formValue">
                <div class="checkbox">
                    <label>
                        <input id="UnitNum" type="text" style="width:40px;" />
                        <select id="Unit" style="border: 0px;">
                            <option selected="selected" value="0">天</option>
                            <option value="1">周</option>
                            <option value="2">月</option>
                            <option value="3">季</option>
                            <option value="4">年</option>
                        </select>
                        <input type="text" style="width:40px;" id="Frequency" />次
                    </label>
                </div>
            </td>
        </tr>
        <tr>
            <th class="formTitle">工作时间段</th>
            <td>
                <input id="StartDate" type="text" class="form-control input-wdatepicker" value="@DateTime.Now.ToString("MM-dd")" style="width:120px;float:left" placeholder="请输入开始日期" onfocus="WdatePicker({ dateFmt: 'MM-dd' })" />
                <div style="float: left; height: 28px; line-height: 28px;">&nbsp;~&nbsp;</div>
                <input id="EndDate" type="text" class="form-control input-wdatepicker" value="@DateTime.Now.AddMonths(1).ToString("MM-dd")" style="width: 120px;float: left; " placeholder="请输入结束日期" onfocus="WdatePicker({  dateFmt: 'MM-dd' })" />
                <div style="float: left; height: 28px; line-height: 28px; ">&nbsp;：&nbsp;</div>
                <input id="StartTime" type="text" class="form-control input-wdatepicker" value="08:00" style="width:120px;float:left" placeholder="请输入开始日期" onfocus="WdatePicker({ dateFmt: 'HH:mm', maxDate: '#F{$dp.$D(\'EndTime\')}' })" />
                <span style="float: left; height: 28px;line-height:28px;">&nbsp;~&nbsp;</span>
                <input id="EndTime" type="text" class="form-control input-wdatepicker" value="12:00" style="width: 120px;float: left; " placeholder="请输入结束日期" onfocus="WdatePicker({  dateFmt: 'HH:mm', minDate: '#F{$dp.$D(\'StartTime\')}' })" />
            </td>
        </tr>
        <tr>
            <th class="formTitle" valign="top" style="padding-top: 4px;">
                说明
            </th>
            <td class="formValue">
                <textarea id="Memo" class="form-control" style="height: 70px;"></textarea>
            </td>
        </tr>
    </table>
</div>

